﻿<UserControl x:Class="OSChina.Controls.MsgListControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:tileEffect="clr-namespace:WP7_ControlsLib.Controls;assembly=WP7_ControlsLib"
             tileEffect:TiltEffect.IsTiltEnabled="True"
             xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <UserControl.Resources>
        <DataTemplate x:Key="template_Normal">
            <Grid Margin="0,16,0,24">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <!-- 头像 -->
                <Image Name="img" Width="50" Height="50" VerticalAlignment="Top" Margin="0,7,0,0" Source="{Binding portrait,Mode=OneTime}" MouseLeftButtonUp="img_MouseLeftButtonUp" />
                <StackPanel Grid.Column="1" Margin="5,0,0,0">
                    <TextBlock Style="{StaticResource style_TitleText}" Text="{Binding source,Mode=OneTime}" FontSize="22" Height="27" Width="330" />
                    <TextBlock Style="{StaticResource style_DefaultText}" Text="{Binding content,Mode=OneTime}" FontSize="22" Width="330" />
                    <TextBlock Style="{StaticResource style_BodyText}" Text="{Binding date,Mode=OneTime}" Foreground="Gray" Margin="0,5,0,0" />
                </StackPanel>
                <Grid Width="38" Height="21" Margin="14,10 ,0,0" Background="{StaticResource PhoneAccentBrush}" Grid.Column="2" VerticalAlignment="Top">
                    <TextBlock Text="{Binding messageCount,Mode=OneTime}" FontSize="17" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Top" />
                </Grid>
                <toolkit:ContextMenuService.ContextMenu>
                    <toolkit:ContextMenu>
                        <toolkit:MenuItem x:Name="menu_Delete"
                                                  Header="删除对话" Click="menu_Delete_Click" />
                    </toolkit:ContextMenu>
                </toolkit:ContextMenuService.ContextMenu>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <ListBox Name="list_Msg" ItemTemplate="{StaticResource template_Normal}" SelectionChanged="list_Msg_SelectionChanged">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel CacheMode="BitmapCache"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</UserControl>
